package com.xiyue.lenovo.startactivity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //获取应用程序中bn按钮
        Button bn = (Button) findViewById(R.id.bn);
        //为bn按钮绑定事件监听器
        bn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //创建需要启动的Activity对应得Intent
                Intent intent = new Intent(MainActivity.this,secondActivity.class);
                //启动Intent对应的Activity、
                startActivity(intent);
            }
        });

    }
}
